<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/layuimini/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/layuimini/css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layuimini-container layuimini-page-anim">
    <div class="layuimini-main">
<form id="userForm">
<div class="layui-form layuimini-form" lay-filter="add_ncc">
    <div class="layui-form-item">
        <label class="layui-form-label required">邮件服务器</label>
        <div class="layui-input-block">
            <input type="text" name="host" id="host" lay-verify="required" lay-reqtext="邮件服务器名称不能为空" placeholder="请输入邮件服务器名称" value="{{objs.host}}" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">邮箱账号</label>
        <div class="layui-input-block">
            <input type="text" name="email" id="email" lay-verify="required" lay-reqtext="邮箱账号不能为空" placeholder="请输入邮箱账号" value="{{objs.email}}" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">密码</label>
        <div class="layui-input-block">
            <input type="password" name="password" id="password" autocomplete="off" lay-verify="required" lay-reqtext="密码不能为空" placeholder="请输入密码" value="{{objs.password}}" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">端口</label>
        <div class="layui-input-block">
            <input type="text" name="port" id="port" lay-verify="required" lay-reqtext="端口不能为空" placeholder="请输入端口" value="{{objs.port}}" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">发件人昵称</label>
        <div class="layui-input-block">
            <input type="text" name="cname" id="cname"  value="{{objs.cname}}" lay-verify="required" lay-reqtext="发件人昵称不能为空" placeholder="请输入发件人昵称"  class="layui-input">
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">API</label>
        <div class="layui-input-block">
            <input type="text" name="apitoken" id="apitoken"  value="{{objs.apitoken|default:''}}" lay-reqtext="编码不能为空" placeholder="请输入编码"  class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="attention">立即提交</button>
        </div>
    </div>

</div>

</form>

<script src="/static/layuimini/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
</div>
</div>

<script>
    layui.use(['form', 'layedit', 'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;
        window.$ = layui.$;

        /**
         * 初始化表单，要加上，不然刷新部分组件可能会不加载
         */
        form.render();

        //监听提交
        form.on('submit(attention)', function (data) {
            $.ajax({
                url: '/alert/attentionconfig/',
                type: 'POST',
                data: data.field,
                success: function (res) {
                    //layer.alert(res.msg);
                    location.reload();
                }
            })


        });
    });
</script>

</body>
</html>